<template>
  <div class="block">
    <el-carousel height="350px" trigger="click" >
      <el-carousel-item v-for="item in 4" :key="item" >
        <h3>
          <img :src="imgArray[item]">
        </h3>
      </el-carousel-item>
    </el-carousel>
  </div>
<div class="block">
    <el-carousel height="350px" trigger="click" :interval="4000" :initial-index="0" >
      <el-carousel-item v-for="item in 4" :key="item" >
        <h3>
          <img :src="imgArray[item]">
        </h3>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import { reactive, toRefs } from 'vue'

export default {
  setup () {
    const state = reactive({
      imgArray: [
        require('../assets/0.jpg'),
        require('../assets/1.jpg'),
        require('../assets/2.jpg'),
        require('../assets/3.jpg'),
        require('../assets/4.jpg')
      ]
    })

    return {
      ...toRefs(state)
    }
  }
}
</script>

<style scoped>
 .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }
.el-carousel{
  width:500px;
}
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
</style>
